<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateNewsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('news', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('title')->comment('新闻标题');
            $table->string('summary')->nullable()->comment('新闻摘要');
            $table->unsignedBigInteger('user_id')->default(0)->comment('用户 ID');
            $table->text('body')->comment('新闻正文');
            $table->unsignedBigInteger('view_counts')->default(0)->comment('新闻浏览量');
            $table->unsignedBigInteger('comment_counts')->default(0)->comment('新闻评论数');
            $table->unsignedBigInteger('thumb_up_counts')->default(0)->comment('新闻点赞数');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('news');
    }
}
